home *** CD-ROM | disk | FTP | other *** search
-
-
- MADINPUT ver 2.01
- September 1987
-
- Update Note: Version 2.01 is a minor update. It is exactly the same
- release as version 2.00 except that it includes a version of the code minus
- line numbers for compiled-only usage. Details of the "how-to"
- use this compiled version are not included, it is assumed that anyone using
- the compiler will already know how to integrate this code.
-
- ***************************************************************************
-
- MADINPUT VER 2.0
- March 1987
-
- User Guidelines
-
- ***************************************************************************
-
- PREFACE TO VERSION 2.0: This is release 2.0 of MADINPUT. It replaces and
- supercedes the first release version 1.0.
-
- It includes several improvements and enhancements including:
-
- -The original release (version 1.0) consisted of two subroutines
- at lines 20000 & 30000. This version has only 1 subroutine that
- handles both numeric and alpha/numeric input. The subroutine
- starts at line 20000.
-
- -Version 2.0 will fill and justify alphanumeric input fields.
-
- * Alphanumeric input fields will automatically be left or right
- justified into fixed length fields and may be padded on the
- left or right with any character selected by the user.
-
- * This feature greatly reduces the programmers need to manipulate
- the data returned in variable SYSALPHA$ in order to make it
- usable by the calling program.
-
- * For example : if the appropriate settings are initialized
- the user may type "123" into a field defined as 5 characters.
- MADIN200 can be configured to return "00123" in SYSALPHA$.
- Alternatively, " 123" or "123 " or "123 " may also be
- returned.
-
- * Likewise, keying "BROWN" into a field defined as 10 characters
- can be set up to return "BROWN " or " BROWN" or
- "-----BROWN", etc. The fill character is user selectable.
-
- -Version 2.0 maintains SYSNUM! return of numeric only fields
-
- *Numeric only editing is still maintainable with the proper
- initialization to accept only 0-9 from the keyboard
-
- * Note: when this functionality is used no justify or fill
- takes place. (This may change with subsequent releases)
-
- ***************************************************************************
- MADIN200 ia a subroutine of use to the novice and experienced
- BASIC programmer who can make use of tailorable field input subroutines.
-
- This routine eleminates the need to perform the usual LOCATE, COLOR,
- and field setup chores for most programs. It is designed to be flexible
- and extremely easy to use.
-
- In the simplest form usage is described below. First however
- let me explain the primary function.
-
- The subroutine beginning at line 20000 returns to the user whatever
- input was keyed into the desired field. This data is returned to the
- user in a string variable named SYSALPHA$ or in numeric variable SYSNUM,
- depending on the calling programs setup.
-
- MADIN200 Performs the following functions:
-
- - Locate to the desired row & column
- - Print a field-mask showing the user the field-size
- - Position a custom-designed cursor at the beginning of the field
- - Allow only valid keystrokes (numeric or string)
- - Force carriage return to exit the field
- - Replace 'backspaced-over' characters with the field mask character
- - Return the string or variable to the main body of the program
- Ver 2.0 - Left or Right Justify Alphanumeric data into fixed length format
- - Pad leading or trailing positions with any user selected character,
- (usually 0 or blank).
-
-
- While there is nothing too exotic about all this, the routines are usefull
- because of their unique tailorability thru variable set-up. This
- is described as follows:
-
- Variable Name Usage
- ============= =======================================
-
- ROW% LOCATE TO THE ROW NUMBER IN THIS VARIABLE
-
- COL% LOCATE TO THE COLUMN NUMER IN THIS VARIABLE
-
- FLDSIZ% THE SIZE (LENGTH) OF THE INPUT FIELD
-
- FLDFG% THE FOREGROUND COLOR VALUE OF THE FIELD
- MASK CHARACTER
-
- FLDBG% THE BACKGROUND COLOR VALUE OF THE FIELD
- MASK CHARACTER
-
- CURSFG% THE FOREGROUND COLOR VALUE OF THE CURSOR
- CHARACTER
-
- CURSBG% THE BACKGROUND COLOR VALUE OF THE CURSOR
- CHARACTER
-
- CHRFG% THE FOREGROUND COLOR VALUE OF THE ACTUAL
- DATA ENTERED BY THE USER
-
- CHRBG% THE BACKGROUND COLOR VALUE OF THE ACTUAL
- DATA ENTERED BY THE USER
-
- FLDCHR% THE ASCII CHARACTER CODE OF THE FIELD MASK
-
- CURCHR% THE ASCII CHARACTER CODE OF THE CUSTOM CURSOR
-
-
- Ver 2.0 FILCHR$ THIS IS THE USER SELECTABLE FILL CHARACTER
-
- " SYSTYP% THIS IS THE USER DEFINABLE INPUT TYPE:
- SYSTYP%=1 SET UP RIGHT JUSTIFIED &
- LEFT FILLED ALPHANUMERIC INPUT
-
- SYSTYP%=2 SET UP NUMERIC (0-9 ONLY)
- NO FILL, NO JUSTIFY, DATA RETURNED
- IN SYSNUM!
-
- SYSTYP%=3 SET UP LEFT JUSTIFIED &
- RIGHT FILLED ALPHANUMERIC INPUT
-
- SYSFIL$ VARIABLE USED BY THIS ROUTINE, NOT FOR
- USE BY USER
- The subroutines supplied contain certain default setting for each of
- these variables at the top section prior to line 20000. You obviously
- may wish to change them.
-
- A simple sample example of using this routine can be constructed as
- follows:
-
- 1. Load the subroutins as supplied into the BASIC interpreter.
- 2. Add the following lines of code:
-
- 300 CLS
- 350 COLOR 10,0
- 400 REM -------------SAMPLE ALPHA INPUT RIGHT JUSTIFY ZERO FILL--
- 420 LOCATE 8,1:PRINT "ENTER A NUMBER OF 1 TO 5 CHARACTERS"
- 450 ROW%=10 : COL%=1 : FLDSIZ%=5 : SYSTYP%=1 : FILCHR$="0"
- 500 GOSUB 20000
- 550 LET A$=SYSALPHA$
- 575 REM -------------SAMPLE USAGE OF NUMERIC ROUTINE-------------
- 600 ROW%=12 : COL%=1 : FLDSIZ%=3 : SYSTYP%=2 : GOSUB 30000 : B=SYSNUM
- 650 REM ---------------------------------------------------------
- 700 LOCATE 10,15:PRINT A$;
- 800 LOCATE 12,15:PRINT B;
- 900 FOR X=1 TO 700:NEXT X
- 1000 GOTO 300
-
- Obviously, any line can include as little parameter-ization as line
- 600 in the example above, or as much as color , mask character, and
- cursor character changes.
-
- For Example :
-
- 600 ROW%=10:COL%=12:FLDSIZ%=4:FLDCHR%=249:CURCHR%=177:CHRBG%=14:SYSTYP%=1
- 605 GOSUB 20000
- 610 ACCOUNT$=SYSALPHA$
-
-
- Note that only the variables representing changing input requirements
- need be specified, if you were inputing a series of numbers, and wanted
- no formatting you could simply do the following:
-
- (assuming you have included the setup statements prior to line 20000 at
- the top of your program)
-
- ROW%=10:COL%=1:GOSUB 20000
- ACCT=SYSNUM
- ROW%=11:COL%=1:GOSUB 20000
- QTY=SYSNUM
- ROW%=12:COL%=1:GOSUB 20000
- COUNT=SYSNUM
-
- TOTAL=QTY*COUNT
- PRINT TOTAL
-
- ...then to turn on left-justify and blank fill to the right
-
- ROW%=20:COL%=1:SYSTYP%=3:FILCHR$=" ":GOSUB 20000
- NAME$=SYSALPHA$
- PRINT NAME$
- ...and then right-justify and zero fill to the left
-
- ROW%=23:COL%=1:SYSTYP%=1:FILCHR$="0":GOSUB 20000
- ZIPCODE$=SYSALPHA$
- PRINT ZIPCODE$
-
- ......and so forth
-
- While there are a whole lot of modifiable parameters, very few need change
- to actually use the "standard" function of this routine.
-
-
- Feel free to experiment with these routines and use them if they can benefit
- you. Chances are if you're an experienced programmer you have somthing
- very similiar, and perhaps a lot slicker. If not, then these may be of
- real benefit to you.
-
- Future revisions will eventually make their way as I complete them.
-
- I may be reached at the address below, or preferably via Compuserve.
-
- I will respond to meaningfull correspondence.
-
-
- Suggestions are very welcome.
-
-
- As with any public domain donation, this author accepts supporting
- contributions if you feel this product warrants your support.
-
- You support can be in the form of feedback, suggestions or criticisms,
- and of course monetary support. If you decide on monetary support
- a $7 contribution is suggested.
-
- Also, there are a few rules (the usual stuff) regarding ANY use of these
- routines:
-
- 1-They may be freely exchanged, shared, or copied without
- reservation for non commercial private use for which
- no profit or gain has been incurred
- 2-If distributed in any form they must be complete and
- UN-MODIFIED and include this documentation
- 3-They may be used in commercial applications of programs
- written for profit or gain ONLY if such use is registerd
- with the author at the address below and if such
- usage-registration is accompanied with a one-time fee
- of $20.00
-
-
- Thank you.
-
- HAWKE SYSTEMS LTD.
- Michael Dalton
- 283 Dahlia Drive
- Louisville CO 80027
-
- Compuserve ID: 71410,2624
-
- MADINPUT version 2.0 MADIN200 released to public domain 3/22/87
- copyright 1987 by Michael A. Dalton & Hawke Systems Ltd.